home *** CD-ROM | disk | FTP | other *** search
- Path: dialin1-45.wustl.edu!user
- From: rdk2@cec.wustl.edu (Rob Klapper)
- Newsgroups: comp.lang.c++
- Subject: Passing a type-specifier as an argument?!?
- Date: Mon, 26 Feb 1996 15:06:44 -0600
- Organization: Washington University in St. Louis, MO USA
- Message-ID: <rdk2-2602961506440001@dialin1-45.wustl.edu>
- NNTP-Posting-Host: @dialin1-45.wustl.edu
-
- OK, here's the deal, essentially, I would like to have a function
- _ones() which could be called like _ones(int), to return an int with its
- bit pattern all ones. I've tried various way to pass just a
- type-specifier as an argument, but to no avail.
-
- The way I do this now is:
-
- #define _ones(t) _onesguts(t(0))
-
- template <class T>
- T _onesguts(T n){
- // stuff...
- }
-
- What I would like to know is if there is a way to get around having to use
- a define to do this. Any help is geatly appreciated...
-
- --
- Robert D. Klapper
- rdk2@cec.wustl.edu
- http://www.cec.wustl.edu/~rdk2
-
- The Murphy Philosophy: Smile. Tommorrow will be worse.
-